package com.jn.zhinongbao.adapter.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class News implements Parcelable {
    private int id;
    private String title;
    private String summary;
    private String content; // 富文本HTML内容
    private String imageUrl;
    private String author;
    private int authorId;
    private String category;
    private int viewCount;
    private String createTime;
    private String updateTime;

    public News() {}

    public News(String title, String summary, String content, String imageUrl, String author, int authorId, String category) {
        this.title = title;
        this.summary = summary;
        this.content = content;
        this.imageUrl = imageUrl;
        this.author = author;
        this.authorId = authorId;
        this.category = category;
        this.viewCount = 0;
    }

    protected News(Parcel in) {
        id = in.readInt();
        title = in.readString();
        summary = in.readString();
        content = in.readString();
        imageUrl = in.readString();
        author = in.readString();
        authorId = in.readInt();
        category = in.readString();
        viewCount = in.readInt();
        createTime = in.readString();
        updateTime = in.readString();
    }

    public static final Creator<News> CREATOR = new Creator<News>() {
        @Override
        public News createFromParcel(Parcel in) {
            return new News(in);
        }

        @Override
        public News[] newArray(int size) {
            return new News[size];
        }
    };

    // Getters and Setters
    public int getId() { return id; }
    public void setId(int id) { this.id = id; }

    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }

    public String getSummary() { return summary; }
    public void setSummary(String summary) { this.summary = summary; }

    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }

    public String getImageUrl() { return imageUrl; }
    public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }

    public String getAuthor() { return author; }
    public void setAuthor(String author) { this.author = author; }

    public int getAuthorId() { return authorId; }
    public void setAuthorId(int authorId) { this.authorId = authorId; }

    public String getCategory() { return category; }
    public void setCategory(String category) { this.category = category; }

    public int getViewCount() { return viewCount; }
    public void setViewCount(int viewCount) { this.viewCount = viewCount; }

    public String getCreateTime() { return createTime; }
    public void setCreateTime(String createTime) { this.createTime = createTime; }

    public String getUpdateTime() { return updateTime; }
    public void setUpdateTime(String updateTime) { this.updateTime = updateTime; }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(title);
        dest.writeString(summary);
        dest.writeString(content);
        dest.writeString(imageUrl);
        dest.writeString(author);
        dest.writeInt(authorId);
        dest.writeString(category);
        dest.writeInt(viewCount);
        dest.writeString(createTime);
        dest.writeString(updateTime);
    }
} 